<cfparam name="doaction" default="nothing">
<cfparam name="showform" default="1">

<cfif doaction IS 'add'>
	<cfinvoke component="cfcs.common.dbqueries" method="insertdata" tablename="core_admins_types" />
	<cfinvoke component="cfcs.common.shared" method="redirect" url="index.cfm?c=cpusers&a=groups" msg="New group was added." />
	<cfset showform = 0>
</cfif>
<cfif doaction IS 'delete'>
	<cfquery name="qdelete" datasource="#request.dsn#">
    DELETE FROM core_admins_types
    WHERE id = <cfqueryparam value="#url.id#" cfsqltype="cf_sql_integer">
    </cfquery>
</cfif>
<cfif showform IS 1>
<cfinvoke component="cfcs.common.settings" method="getusergroups" returnvariable="qgroups"></cfinvoke>
<table width="100%" border="0" cellspacing="0" cellpadding="6">
<form method="post" action="index.cfm?c=cpusers&a=groups&doaction=add">
  <tr>
    <td><input name="groupname" type="text" id="groupname" size="30"></td>
    <td><select name="listtype" id="listtype">
    <option value="0">Black List</option>
    <option value="1">White List</option>
    </select>
    </td>
    <td><input type="submit" name="button" id="abutton" value="Add Group"></td>
  </tr>
</form>
  <tr>
    <td width="30%" id="columnheaders">User Type</td>
    <td width="20%" id="columnheaders">Rules List Type</td>
    <td width="71%" id="columnheaders">&nbsp;</td>
  </tr>
<cfloop query="qgroups">
<cfoutput>
  <tr class="menu_row" onMouseOver="this.className = 'menu_row_over2';" onMouseOut="this.className = 'menu_row';">
    <td class="menu_cell">#groupname#</td>
    <td class="menu_cell"><cfif listtype IS 0>Black List</cfif><cfif listtype IS 1>White List</cfif></td>
    <td class="menu_cell"><a href = "index.cfm?c=cpusers&a=permissions&groupid=#id#"><img src="images/icons/lock.png" alt="Edit Permissions" title="Edit Permissions" border="0"></a>&nbsp;&nbsp;&nbsp;&nbsp;<a href = "javascript: ConfirmDeleteAdmin('#id#', '#groupname#');"><img src="images/delete.png" alt="Delete Group" title="Delete Group" border="0"></a></td>
  </tr>
</cfoutput>
</cfloop>
</table>
</cfif>